//package com.cql.configuration;
//
//import com.fasterxml.jackson.databind.JsonNode;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import feign.Request;
//import feign.RequestInterceptor;
//import feign.RequestTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.io.IOException;
//import java.util.Collection;
//import java.util.HashMap;
//import java.util.Map;
//
//@Component
//public class FeignRequestInterceptor implements RequestInterceptor {
//    @Autowired
//    private ObjectMapper objectMapper;
//
//    @Override
//    public void apply(RequestTemplate requestTemplate) {
//        //feign不支持get方法转POJO， json body转query
//        if (requestTemplate.method().equals("GET") && requestTemplate.body() != null) {
//            try {
//                JsonNode jsonNode = objectMapper.readTree(requestTemplate.body());
//                requestTemplate.body((Request.Body) null);
//                Map<String, Collection<String>> queries = new HashMap<>();
//                buildQuery(jsonNode, "", queries);
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//    }
//}
